package com.cn.juc.ex.demo;

/**
 * @author: zhangyi
 * @date: 2019/1/11 15:03
 * @description:
 */
public class Demo {
    public static void main(String[] args) {
        new Thread(new MultiThread.StaticMultiThread(110L)).start();
        new Thread(new MultiThread.StaticMultiThread(999L)).start();
        new Thread(new MultiThread.ReadT()).start();

    }
}
class MultiThread{
    public static long t = 0;
    public static class StaticMultiThread implements Runnable{
        private long st = 0;

        public StaticMultiThread(long st) {
            this.st = st;
        }

        @Override
        public void run() {
            while(true){
                MultiThread.t = st;
                Thread.yield();
            }
        }
    }

    public static class ReadT implements Runnable{
        @Override
        public void run() {
            while(true){
                long tempLong = MultiThread.t;
                if(tempLong == 110L && tempLong == 999L){
                    System.out.println(tempLong);
                }
                Thread.yield();
            }
        }
    }
}